<%--
  Created by IntelliJ IDEA.
  User: ASUS
  Date: 2025/8/29
  Time: 11:01
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script type="text/javascript" src="js/jquery-1.8.3.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {

            show(1);

        });

        $(document).on("click","input[alt]",function () {
            show($(this).attr("alt"));
        })
        function show(indexpage) {

            //窗体加载后，发送异步请求，获得分页数据
            $.get("wo/getListByPage",{"indexpage":indexpage},function (ph) {

                JSON.stringify(ph);


                //获得ph里的集合，循环遍历到tbody里
                $("tbody").empty();
                for (var i=0;i<ph.listIndex.length;i++){
                    var obj=ph.listIndex[i];
                    $("<tr>\n" +
                        "        <th>"+obj.id+"</th>\n" +
                        "        <th>"+obj.pname+"</th>\n" +
                        "        <th>"+obj.executor+"</th>\n" +
                        "        <th>"+obj.description+"</th>\n" +
                        "        <th>"+obj.orderlevel+"级</th>\n" +
                        "        <th>"+obj.createdate+"</th>\n" +
                        "    </tr>").appendTo("tbody");
                }


                //获得ph里的属性，动态添加到tfoot
                $("tfoot").empty();
                if (ph.pageIndex!=1){
                    $("<input type='button' value='首页' alt='1'/>").appendTo("tfoot");
                    $("<input type='button' value='上一页' alt='"+(ph.pageIndex-1)+"'/>").appendTo("tfoot");
                }
                if (ph.pageIndex!=ph.pageCount){
                    $("<input type='button' value='下一页' alt='"+(ph.pageIndex+1)+"'/>").appendTo("tfoot");
                    $("<input type='button' value='尾页' alt='"+ph.pageCount+"'/>").appendTo("tfoot");
                }


            });

        }

    </script>
</head>
<body>
<table>
    <caption>企业工单列表</caption>
    <thead>
    <tr>
        <th>工单编号</th>
        <th>项目名称</th>
        <th>执行人</th>
        <th>任务描述</th>
        <th>级别</th>
        <th>创建时间</th>
    </tr>
    </thead>
    <tbody></tbody>
    <tfoot></tfoot>
</table>
</body>
</html>
